<?php
require_once(dirname(__FILE__) . "/../core/safeParam.php");
$pizzas                  = $database->select("SELECT * FROM pizza_feasts where rid = " . RID . "");
$pizzas_feasts_items     = $database->select("SELECT * FROM pizza_feasts_items where rid = " . RID . "");
$pizzas['toppings']      = explode(",", trim($pizzas[0]['toppings']));
$pizzas['meat_toppings'] = explode(",", trim($pizzas[0]['meat_toppings']));
$pizzas['topoff']        = explode(",", trim($pizzas[0]['topoff']));
$pizzas['base']          = explode(",", trim($pizzas[0]['base']));
$pizzas['sides']         = unserialize($pizzas[0]['sides']);
$pizzas['topping_price'] = explode(",", trim($pizzas[0]['topping_price']));
if ($_GET['id'] == "") {
  $results_items = $database->select("SELECT * FROM pizza_feasts_items  WHERE  rid = " . RID . "  order by name");
  if ($results_items[0]['name'] != '') {
    for ($h = 0; $h < count($results_items); $h++) {
      $results_items[$h]['prices']    = unserialize($results_items[$h]['price']);
      $results_items[$h]['optionsun'] = unserialize($results_items[$h]['options']);
    } //$h = 0; $h < count($results_items); $h++
  } //$results_items[0]['name'] != ''
  $results_pizza = $results_items;
} //$_GET['id'] == ""
else {
  $results_items                 = $database->select("SELECT * FROM pizza_feasts_items  WHERE  id = " . $_GET['id'] . "");
  $results_items[0]['prices']    = unserialize($results_items[0]['price']);
  $results_items[0]['optionsun'] = unserialize($results_items[0]['options']);
  $results_pizza                 = $results_items[0];
}
//print_r($results_pizza);
$topping_price = $pizzas[0]['topping_price'];
$smarty->assign("pizza_feasts", $results_pizza);
$smarty->assign("pizza", $pizzas);
$smarty->assign("pizza_feasts_items", $pizzas_feasts_items);
$smarty->assign("topping_prices", $topping_price);
?>
